package com.designmodel.designmodel.Strategy_Pattern策略模式;

public class Cat implements  Comparable{
	private int height;
	private int weight;
	private  Comparator comparator;

	public Cat(int height, int weight, Comparator comparator) {
		this.height = height;
		this.weight = weight;
		this.comparator = comparator;
	}

	public Comparator getComparator() {
		return comparator;
	}

	public void setComparator(Comparator comparator) {
		this.comparator = comparator;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public int getWeight() {
		return weight;
	}

	public void setWeight(int weight) {
		this.weight = weight;
	}

	@Override
	public String toString() {
		return "Cat{" +
				"height=" + height +
				", weight=" + weight +
				'}';
	}

	@Override
	public int compareTo(Object o) {

		return comparator.compare(this,o);
	}
}
